Dogfood the shared PHP-CS-Fixer config in CI#40
Merged
Conversation
Add a .php-cs-fixer.dist.php that lints this package with its own shared config, plus a strict PHP-CS-Fixer CI gate so a config regression (e.g. a rule renamed or removed by a dependency bump) fails loudly instead of shipping unnoticed. - .php-cs-fixer.dist.php: uses Config::create(); excludes vendor/.cache and the intentionally-malformed sniff test fixtures (tests/Sniffs/**); disables mb_str_functions (this package processes ASCII PHP tokens, not user-facing strings, so it should not pull in an ext-mbstring runtime dependency). - composer.json: add `php-cs-fixer` and `php-cs-fixer:check` scripts. - .github/workflows/php-cs-fixer.yml: strict dry-run gate (mirrors psalm.yml). - Apply the resulting formatting to the package source. - BladeTemplateExtractor: turn the `phpcs:disable` doc block into a line comment so PHP-CS-Fixer no longer expands it into a multi-line doc block that then conflicts with SlevomatCodingStandard.Commenting.RequireOneLineDocComment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to the PHP-CS-Fixer config work. The package never linted itself with its own shared config, so config regressions could ship unnoticed (that is how the
@api-strip and the arrow/octal/numeric-separator surprises slipped through earlier). This adds a self-lint plus a strict CI gate.Changes
.php-cs-fixer.dist.php— lints this package withConfig::create(). Excludesvendor/.cacheand the intentionally-malformed sniff test fixtures (tests/Sniffs/**, reformatting them would shift line numbers and break the sniff tests). Disablesmb_str_functions: this package processes ASCII PHP tokens, not user-facing strings, so it should not pull in anext-mbstringruntime dependency.composer.json—php-cs-fixer(fix) andphp-cs-fixer:check(dry-run) scripts..github/workflows/php-cs-fixer.yml— strict dry-run gate (mirrorspsalm.yml). Intentionally a hard gate, not the auto-commit pattern offormat_php.yml, so a rule renamed/removed by a Renovate bump fails loudly.BladeTemplateExtractor— thephpcs:disablewas a/** */doc block; PHP-CS-Fixer expanded it to multi-line, which then trippedSlevomatCodingStandard.Commenting.RequireOneLineDocComment. Changed it to a line comment (a directive is not documentation). This conflict was found by the new self-lint.Verification
composer php-cs-fixer:checkexits 0 (idempotent).vendor/bin/phpunit: 18 passing (fixtures untouched).phpcsself-check: 0 errors.composer validate: clean.